package com.mydemo.admin.service.impl;

import com.mydemo.common.utils.EmailUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 邮件服务
 *
 * @author Last_Island
 * @version 1.0
 */
@Service
public class EmailService {
    @Autowired
    private EmailUtils emailUtils;

    /**
     * 发送邮箱验证码
     *
     * @param targetMail 接收人
     * @param captcha 验证码
     */
    public void sendCaptcha(String targetMail, String captcha) {
        String subject = "验证码";
        String message = "您好，您的验证码为：" + captcha + "，5分钟内有效，请勿泄露给他人。";
        emailUtils.sendMail(targetMail, subject, message);
    }

    /**
     * 自定义邮件
     *
     * @param targetMail 接收人
     * @param subject 邮件主题
     * @param message 邮件消息
     */
    public void sendEmail(String targetMail, String subject, String message) {
        emailUtils.sendMail(targetMail, subject, message);
    }
}
